home *** CD-ROM | disk | FTP | other *** search
Wrap
global gArtSprite, gAltParamList, gExportList, gInstructStart, gInstructionsList, gInstructions, gPasteList, gInstructionWindow, gFirstWindowFlag, gInstructRect, gInstructStep, gInstructTotal, gWizWindow, gButtonName, LocationList, gCurrentSprite, PasteInfoList, gSpriteCount, gSpritePhrase, gUserSelection, gFrameCountMin, gFrameCountMax, gStartFrame, gStartSprite, gExportScriptList on startMovie set gArtSprite to 24 set gFirstWindowFlag to 0 set gWizWindow to the movieName set gExportScriptList to [] go(1) end on stopMovie cursor(-1) forgetInstructions() if objectp(window gWizWindow) then forget(window gWizWindow) end if end on closeWindow set myName to the movieName set offS to offset(".dir", myName) if offS then delete char offS to offS + 4 of myName end if forget(window myName) end on validateUserSelection set gCurrentSprite to 24 set gFrameCountMin to 5 set gFrameCountMax to 15 set mySprite to gCurrentSprite set myFlag to 1 set gSpriteCount to 0 repeat while myFlag = 1 if the type of sprite mySprite = 0 then if the type of sprite (mySprite + 1) = 0 then set myFlag to 0 exit repeat else set gSpriteCount to gSpriteCount + 1 set mySprite to mySprite + 1 end if next repeat end if set gSpriteCount to gSpriteCount + 1 set mySprite to mySprite + 1 end repeat if gSpriteCount = 1 then set gSpritePhrase to "channel" else set gSpritePhrase to "channels" end if tell the stage set gUserSelection to the scoreSelection end tell if gUserSelection = [] then alert("Please click in the score where you want the widget to begin, then try again. You need " && gSpriteCount && "sprite" && gSpritePhrase && "and at least" && gFrameCountMin && "frames. ") abort() end if set gStartSprite to getAt(getAt(gUserSelection, 1), 1) set myEndSprite to gStartSprite + gSpriteCount - 1 set gStartFrame to getAt(getAt(gUserSelection, 1), 3) set myEndFrame to gStartFrame + gFrameCountMax - 1 if gStartSprite < 1 then alert("Your selection must start in sprite channel 1 or greater. Please make a new selection and try again.") abort() end if tell the stage repeat with y = gStartFrame to myEndFrame set myFrameCounter to y - gStartFrame go(y) repeat with z = gStartSprite to myEndSprite if the type of sprite z <> 0 then if myFrameCounter < gFrameCountMin then alert("This selection contains something already. You need " && gSpriteCount && "sprite" && gSpritePhrase && "and at least" && gFrameCountMin && "frames. Please click in the score where you want the widget to begin, then try again.") abort() next repeat end if set gFrameCountMax to myFrameCounter set myEndFrame to myFrameCounter - 1 exit repeat end if end repeat end repeat go(gStartFrame) end tell copyButtonPrime() end on copyButtonPrime cursor(4) go(the frame + 1) go(the frame - 1) set myMemberNum to 1 set PasteInfoList to [] set mySpriteList to [] set myWidgetScriptList to [] set myAssocPasteList to [] repeat with x = gCurrentSprite to gCurrentSprite + gSpriteCount - 1 set myRecord to [#MemberName: EMPTY, #MemberNumber: 0, #ScriptName: EMPTY, #ScriptNumber: 0, #MemberLoc: point(0, 0), #MemberRect: rect(0, 0, 0, 0), #Onstage: 0] if the type of sprite x <> 0 then set the MemberName of myRecord to the name of member the member of sprite x set the MemberLoc of myRecord to the loc of sprite x set the MemberRect of myRecord to the rect of sprite x copyToClipBoard(member the member of sprite x) tell the stage repeat while the type of member myMemberNum of castLib 1 <> #empty set myMemberNum to myMemberNum + 1 end repeat pasteClipBoardInto(member myMemberNum of castLib 1) set the MemberNumber of myRecord to the number of member myMemberNum of castLib 1 end tell if the scriptNum of sprite x > 0 then set myAssocList to [] set myAssocList to getAssocMembers(getAt(the scriptInstanceList of sprite x, 1)) set myAssocPasteIndex to 0 repeat with r = 1 to count(myAssocPasteList) if myAssocList = getAt(myAssocPasteList, r) then set myAssocPasteIndex to r end if end repeat if myAssocPasteIndex = 0 then repeat with a = 1 to count(myAssocList) copyToClipBoard(member getAt(myAssocList, a)) tell the stage repeat while the type of member myMemberNum of castLib 1 <> #empty set myMemberNum to myMemberNum + 1 end repeat pasteClipBoardInto(member myMemberNum of castLib 1) end tell end repeat add(myAssocPasteList, myAssocList) end if set myScriptName to the name of member the scriptNum of sprite x set the ScriptName of myRecord to myScriptName set myWidgetScriptIndex to 0 repeat with q = 1 to count(myWidgetScriptList) if the ScriptName of getAt(myWidgetScriptList, q) = myScriptName then set myWidgetScriptIndex to q end if end repeat if myWidgetScriptIndex = 0 then copyToClipBoard(member the scriptNum of sprite x) set myWidgetScriptRecord to [#ScriptName: EMPTY, #ScriptNumber: 0] set the ScriptName of myWidgetScriptRecord to myScriptName tell the stage repeat while the type of member myMemberNum of castLib 1 <> #empty set myMemberNum to myMemberNum + 1 end repeat pasteClipBoardInto(member myMemberNum of castLib 1) set myScriptNumber to the number of member myMemberNum of castLib 1 set the ScriptNumber of myRecord to myScriptNumber set the ScriptNumber of myWidgetScriptRecord to myScriptNumber end tell add(myWidgetScriptList, myWidgetScriptRecord) else set the ScriptNumber of myRecord to the ScriptNumber of getAt(myWidgetScriptList, myWidgetScriptIndex) end if end if end if add(PasteInfoList, myRecord) end repeat set myFrameScriptName to "loop current frame" copyToClipBoard(member myFrameScriptName) tell the stage repeat while the type of member myMemberNum of castLib 1 <> #empty set myMemberNum to myMemberNum + 1 end repeat pasteClipBoardInto(member myMemberNum of castLib 1) set myFrameScriptNum to the number of member myMemberNum of castLib 1 set myScriptRecord to [#ScriptName: myFrameScriptName, #ScriptNumber: myFrameScriptNum] add(gExportScriptList, myScriptRecord) end tell set myTestRect to rect(1, 1, 496, 342) set myPlacementFlag to 0 repeat with s = 1 to count(PasteInfoList) set myCurrentRect to the MemberRect of getAt(PasteInfoList, s) if union(myTestRect, myCurrentRect) = myTestRect then if myPlacementFlag = 0 then set myPlacementFlag to 1 set myBoundingRect to myCurrentRect else set myBoundingRect to union(myBoundingRect, myCurrentRect) end if set the Onstage of getAt(PasteInfoList, s) to 1 end if end repeat set myBoundingWidth to getAt(myBoundingRect, 3) - getAt(myBoundingRect, 1) set myBoundingHeight to getAt(myBoundingRect, 4) - getAt(myBoundingRect, 2) tell the stage set myStageWidth to the stageRight - the stageLeft set myStageHeight to the stageBottom - the stageTop end tell set myStartH to (myStageWidth - myBoundingWidth) / 2 set myStartV to (myStageHeight - myBoundingHeight) / 2 set myBoundingH to getAt(myBoundingRect, 1) set myBoundingV to getAt(myBoundingRect, 2) tell the stage beginRecording() repeat with y = gStartFrame to gStartFrame + gFrameCountMax - 1 set myListCount to 1 go(y) if the frame = (gStartFrame + gFrameCountMax - 1) then set the frameScript to myFrameScriptNum end if repeat with z = gStartSprite to gStartSprite + gSpriteCount - 1 set myRecord to getAt(PasteInfoList, myListCount) set myListCount to myListCount + 1 if the MemberNumber of myRecord > 0 then set the member of sprite z to the MemberNumber of myRecord if the Onstage of myRecord = 0 then set the loc of sprite z to the MemberLoc of myRecord else set myMemberH to getAt(the MemberLoc of myRecord, 1) set myMemberV to getAt(the MemberLoc of myRecord, 2) set myPasteHdif to myMemberH - myBoundingH set myPasteVdif to myMemberV - myBoundingV set the loc of sprite z to point(myStartH + myPasteHdif, myStartV + myPasteVdif) end if if the ScriptNumber of myRecord <> 0 then set the scriptNum of sprite z to member the ScriptNumber of myRecord end if set the tweened of sprite z to 1 end if end repeat end repeat endRecording() end tell beep(2) cursor(-1) openInstructionWindow() end on setWindowRect if gFirstWindowFlag = 0 then set myLeft to the stageLeft + 50 set myTop to the stageTop + 50 set myWidth to 160 set myHeight to 400 set gInstructRect to rect(myLeft, myTop, myLeft + myWidth, myTop + myHeight) set gFirstWindowFlag to 1 end if end on openInstructionWindow if objectp(gInstructionWindow) then forgetInstructions() end if setWindowRect() set gInstructionWindow to window "Instructions" set the rect of gInstructionWindow to gInstructRect set the fileName of gInstructionWindow to the pathName & "-Instrct.dir" set the titleVisible of gInstructionWindow to 0 set the windowType of gInstructionWindow to 49 open(gInstructionWindow) resetInstructText() end on resetInstructText tell gInstructionWindow displayNewText() end tell end on forgetInstructions if objectp(gInstructionWindow) then set gFirstWindowFlag to 1 set gInstructRect to the rect of gInstructionWindow forget(gInstructionWindow) end if end on initElements set gInstructStart to the frameLabel & "-1" if objectp(gInstructionWindow) then resetInstructText() end if end